package com.wswy.wzcx.ui.web;


import android.content.Context;
import android.support.annotation.Nullable;

import com.che.libcommon.api.ApiOptionalResultObserver;
import com.che.libcommon.api.BaseResult;
import com.che.libcommon.api.page.PageList;
import com.wswy.wzcx.api.Api;
import com.wswy.wzcx.model.news.NewsModel;

import java.util.List;

class AdWebPresenter {

    private IAdWeb adWeb;
    private Context context;

    AdWebPresenter(Context context,IAdWeb adWeb) {
        this.context= context;
        this.adWeb = adWeb;
    }

    void load(){
        Api.get().getRecommendNews().subscribe(new ApiOptionalResultObserver<List<NewsModel>>() {
            @Override
            protected void onApiResult(@Nullable List<NewsModel> list) {
                if (list != null && !list.isEmpty()){
//                    adWeb.showNews(null);
                    adWeb.showNews(list);
                }
            }

            @Override
            protected void onApiError(@Nullable BaseResult result) {

            }
        });

    }
}
